@@ -164,6 +164,13 @@ module LiquidInterpolatable |
||
164 | 164 |
credential |
165 | 165 |
end |
166 | 166 |
end |
167 |
+ |
|
168 |
+ class LineBreak < Liquid::Tag |
|
169 |
+ def render(context) |
|
170 |
+ "\n" |
|
171 |
+ end |
|
172 |
+ end |
|
167 | 173 |
end |
168 | 174 |
Liquid::Template.register_tag('credential', LiquidInterpolatable::Tags::Credential) |
175 |
+ Liquid::Template.register_tag('line_break', LiquidInterpolatable::Tags::LineBreak) |
|
169 | 176 |
end |
@@ -86,14 +86,22 @@ shared_examples_for LiquidInterpolatable do |
||
86 | 86 |
end |
87 | 87 |
|
88 | 88 |
describe "liquid tags" do |
89 |
- it "should work with existing credentials" do |
|
90 |
- expect(@checker.interpolate_string("{% credential aws_key %}", {})).to eq('2222222222-jane') |
|
89 |
+ context "%credential" do |
|
90 |
+ it "should work with existing credentials" do |
|
91 |
+ expect(@checker.interpolate_string("{% credential aws_key %}", {})).to eq('2222222222-jane') |
|
92 |
+ end |
|
93 |
+ |
|
94 |
+ it "should raise an exception for undefined credentials" do |
|
95 |
+ expect { |
|
96 |
+ @checker.interpolate_string("{% credential unknown %}", {}) |
|
97 |
+ }.to raise_error |
|
98 |
+ end |
|
91 | 99 |
end |
92 | 100 |
|
93 |
- it "should raise an exception for undefined credentials" do |
|
94 |
- expect { |
|
95 |
- @checker.interpolate_string("{% credential unknown %}", {}) |
|
96 |
- }.to raise_error |
|
101 |
+ context '%line_break' do |
|
102 |
+ it 'should convert {% line_break %} to actual line breaks' do |
|
103 |
+ expect(@checker.interpolate_string("test{% line_break %}second line", {})).to eq("test\nsecond line") |
|
104 |
+ end |
|
97 | 105 |
end |
98 | 106 |
end |
99 | 107 |
end |